package com.general.common.log;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Aspect;

import com.general.common.exception.BusinessException;

@Aspect
public class LogAspect {

	//private ILogService logService;

	// 标注该方法体为后置通知，当目标方法执行成功后执行该方法体
	@AfterReturning("within(com.general.app.xtgl..*) && @annotation(rl)")
	public void log(JoinPoint jp, BusinessLog rl) {
		
		System.out.println("==============成功执行================");
	}

	// 标注该方法体为异常通知，当目标方法出现异常时，执行该方法体
	@AfterThrowing(pointcut = "within(com.general.app.xtgl..*) && @annotation(rl)", throwing = "ex")
	public void log(JoinPoint jp, BusinessLog rl, BusinessException ex) {
		System.out.println("==============出现异常=================");
	}


//	public void setLogService(ILogService logService) {
//		this.logService = logService;
//	}
}
